package com.vertx.core;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Context;
import io.vertx.core.Vertx;
import io.vertx.core.eventbus.EventBus;

/**
 * @version v1.0
 * @Description: TODO(一句话描述该类的功能)
 * @Author: TongRui乀
 * @Date: 2021/5/7 3:42 下午
 */
public class HelloEventBusConsumer extends AbstractVerticle {

    private EventBus eventBus;

    @Override
    public void init(Vertx vertx, Context context) {
        super.init(vertx, context);
        eventBus = vertx.eventBus();
    }

    @Override
    public void start() throws Exception {

        eventBus.consumer("hello.event_bus", message->{

            System.out.println("receive message :" + message.body());

        });

    }
}
